package conf

import (
	"github.com/spf13/viper"
	"go.uber.org/zap"
)

// WechatSection map toml [wechat]
type WechatSection struct {
	MPAppID    string `mapstructure:"mp_app_id"`
	MinaAppID  string `mapstructure:"mina_app_id"`
	MinaSecret string `mapstructure:"mina_secret"`
	MinaState  string `mapstructure:"mina_state"`
	Tp524      string `mapstructure:"tp524"`
	Tp4959     string `mapstructure:"tp4959"`
	Tp5334     string `mapstructure:"tp5334"`
	Tp974      string `mapstructure:"tp974"`
	Tp1956     string `mapstructure:"tp1956"`
}

// ReadWechat get pg section from config
func ReadWechat(v *viper.Viper, slog *zap.SugaredLogger) (wechatConf WechatSection) {
	err := v.Unmarshal(&wechatConf)
	if err != nil {
		slog.Panicf("unable to decode into pg section, %v", err)
	}
	slog.Debug(wechatConf)
	return
}
